﻿using Avalonia.Controls;
using Avalonia.Controls.Templates;
using MusicFluent.Controls;
using NetEasyMusic.Lib.Models;

namespace MusicFluent.Converters;

public class SongDataTemplate : IDataTemplate
{
    public bool IsAlbum { get; set; }

    public Control Build(object? param)
    {
        if (param is SongModel song) return new SongControl(song, IsAlbum);
        return new TextBlock();
    }

    public bool Match(object? data)
    {
        return data is SongModel;
    }
}

public class SongSimpleDataTemplate : IDataTemplate
{
    public Control Build(object? param)
    {
        if (param is SongModel song) return new SongSimpleControl(song);
        return new TextBlock();
    }

    public bool Match(object? data)
    {
        return data is SongModel;
    }
}